const App = {
    mixins: [Save],//配置文件，路径/utils/mixins.js
    data() {
        return {
            Comment_Object_SerialNumber:'',
            treeData:[],
            news:[]
        };
    },
    mounted() {
        let ls_URL = window.location.href;
        this.action = getQueryObject(ls_URL, "Comment_SerialNumber");   // 获取 action 参数
        this.Comment_Object_SerialNumber= getQueryObject(ls_URL, "Comment_Object_SerialNumber");   // 获取 action 参数
        this.getCategory();
    },
    methods: {
        getCategory() {
            // $.ajax({
            //     headers: requestHeaders(),
            //     url: `${mh}/generalBusiness/generalQueryForObtainingTrees`,
            //     type: "GET",
            //     data: {
            //         TableName:'comments',
            //         NodeCode:this.action
            //     },
            //     success: (data) => {
            //         this.treeData = data; // 直接使用 this
            //     },
            //     complete: (XMLHttpRequest) => {
            //         requestPretreatment(XMLHttpRequest)
            //     },
            //     dataType: "json",
            // });
            
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryBySQLSerialNumber`,
                method: "post",
                data: {
                    SQLSerialNumber: 't_comments',
                    Condition: window.btoa(unescape(encodeURIComponent("%%"))),
                    ExtensionCondition: window.btoa(unescape(encodeURIComponent("AND comments.Parent_SerialNumber='" + this.action + "'")))
                },
                success: (data) => {
                    console.log(data);
                    this.treeData = data; // 直接使用 this
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            })
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/comments/getCommentsTreeByCommnetsSerialNumber`,
                type: "GET",
                data: {
                    Comment_Object_SerialNumber: this.Comment_Object_SerialNumber,
                    Data:  this.action,
                    PageNumber:1,
                    RowAmount:10,
                },
                success: (data) => {
                    console.log(data);
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            $.ajax({
                headers: requestHeaders(),
                url: `${mh}/generalBusiness/generalQueryByTableName`,
                type: "POST",
                data: {
                    Data: 'news',
                    Condition: "Row_Status='0'",
                },
                success: (data) => {
                    this.news = data
                },
                complete: (XMLHttpRequest) => {
                    requestPretreatment(XMLHttpRequest);
                },
                dataType: "json",
            });
            // treeData
        },
    },
};
const { createApp, ref } = Vue;
const app = createApp(App);
app.use(ElementPlus,{locale: zhCn});
//这种方式是引入全部图标，无需单个引入
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component);
}
app.component('yl-upload', ylUpload);
app.component('yl-text-editor', ylTextEditor);
const ElMessage = ElementPlus.ElMessage;
app.mount("#app");
